import ajax from "./ajax";
import mock from './mock'
//3.首页三级分类 api/product/getBaseCategoryList
export const reqTypeNav=()=>{
    return ajax({url:'/product/getBaseCategoryList',method:'get'})
}
//获取轮播图mock数据
export const reqBanner=()=>mock({url:'/banner',method:'get'})
//获取floor mock数据
export const reqFloor=()=>mock({url:'/floor',method:'get'})
//4.搜索商品/api/list
export const reqSearch=(search)=>ajax({url:'/list',method:'post',data:search})
//5.获取商品详情请求地址 /api/item/{ skuId }
export const reqDetail=(skuid)=>ajax({url:'/item/'+skuid,method:"get"})
//添加到购物车/api/cart/addToCart/{ skuId }/{ skuNum }
export const reqAddCart=(skuID,skuNum)=>ajax({url:`/cart/addToCart/${skuID}/${skuNum}`,method:'post'})
//6.获取购物车列表/api/cart/cartList
export const reqShopCartList=()=>ajax({url:'/cart/cartList',method:'get'})
// 8.切换商品选中状态 /api/cart/checkCart/{skuID}/{isChecked}
export const reqShopSelect=(skuID,isChecked)=>ajax({url:`/cart/checkCart/${skuID}/${isChecked}`,method:'get'})
//9.删除购物车商品 /api/cart/deleteCart/{skuId}
export const reqDeleteCart=(skuId)=>ajax({url:`/cart/deleteCart/${skuId}`,method:'delete'})
//2.登录 /api/user/passport/login
export const reqLogin=(phone,password)=>ajax({url:"/user/passport/login",data:{phone,password},method:'post'}) 
//16.注册用户 api/user/passport/register
export const reqRegister=(user)=>ajax({url:"/user/passport/register",data:{phone:user.phone,password:user.password,code:user.code},method:'post'}) 
//获取验证码  /api/user/passport/sendCode/{phone}
export const reqCode=(phone)=>ajax({url:`/user/passport/sendCode/${phone}`,method:'get'}) 
//获取用户信息
export const reqUserInfo = ()=>ajax({url:'/user/passport/auth/getUserInfo',method:'get'})
//17.退出登陆 /api/user/passport/logout
export const reqLoginOut = ()=>ajax({url:'/user/passport/logout',method:'get'})
// 获取用户地址信息 /api/user/userAddress/auth/findUserAddressList
export const reqAddress = ()=>ajax({url:'/user/userAddress/auth/findUserAddressList',method:'get'})
// 获取商品清单 /api/order/auth/trade
export const reqTrade = ()=>ajax({url:'/order/auth/trade',method:'get'})
// 12.提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqSumbitOrder = (tradeNo,data)=>ajax({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'})
// 13.获取订单支付信息 /api/payment/weixin/createNative/{orderId}
export const reqPayInfo = (orderId)=>ajax({url:`/payment/weixin/createNative/${orderId}`,method:'get'})
/// 14.查询支付订单状态 api/payment/weixin/queryPayStatus/{orderId}
export const reqPayStatus = (orderId)=>ajax({url:`/payment/weixin/createNative/${orderId}`,method:'get'})
// 11.获取我的订单列表 /api/order/auth/{page}/{limit}
export const reqOrderList = (page,limit)=>ajax({url:`/order/auth/${page}/${limit}`,method:'get'})